#include <allegro.h>
#include <time.h>
#include "Mahmoud_bonus1.h" 





/////
void destroy_plaques( BITMAP** plaque_s, BITMAP** plaque_mb, BITMAP** plaque_p, BITMAP** plaque_6_v)
{
destroy_bitmap(*plaque_s) ;
destroy_bitmap(*plaque_mb) ;
destroy_bitmap(*plaque_p) ;
destroy_bitmap(*plaque_6_v) ;
}
/////////

//////////////
void load_plaques( BITMAP** plaque_s, BITMAP** plaque_mb, BITMAP** plaque_p, BITMAP** plaque_6_v)
{
*plaque_s = load_bitmap("plaque_sparrow.bmp", NULL) ;
*plaque_mb = load_bitmap("plaque_MB.bmp", NULL) ;
*plaque_p = load_bitmap("plaque_pirate.bmp", NULL) ;
*plaque_6_v = load_bitmap("6_plaques_vides.bmp", NULL) ;
if((!*plaque_6_v) || (!*plaque_s) || (!*plaque_mb) || (!*plaque_p))
{
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Erreur ! Impossible de lire le fichier image !");
}
}
//////
void destroy_cursor(BITMAP** curseur)
{
destroy_bitmap(*curseur);
}


void load_cursor(BITMAP** curseur)
{
*curseur = load_bitmap("mouse.bmp", NULL) ;
if(!*curseur)
{
set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
allegro_message("Erreur ! Impossible de lire le fichier image !");
}
}



//////////////rebecca//////////////////////////////////////



void load_Rebecca(Rebecca *R)
{
//int i;
//char tmp[60];
	R->img_bravo=load_bitmap("bravo.bmp", NULL);
	R->img_erreur=load_bitmap("erreur.bmp", NULL);
        R->img_perdu=load_bitmap("perdu.bmp", NULL);

	if ((R->img_bravo == NULL) || (R->img_erreur == NULL) || (R->img_perdu == NULL) )
        {
		set_gfx_mode(GFX_TEXT, 0, 0, 0, 0);
		allegro_message("Unable to load image !\n%s\n", allegro_error);
		
	}	
	

}


void init_Rebecca(Rebecca *R)
{
	
	R->x =500 ;
	R->y =250 ;
}



// MODULE REBECCA BONUS //
void draw_Rebecca_bonus (Rebecca *R,BITMAP *buffer, int indice)
{
if (indice == 0)
{
	draw_sprite(buffer, R->img_bravo,R->x, R->y);
}
if (indice ==1)
{
	draw_sprite(buffer, R->img_erreur,R->x, R->y);
}
if(indice ==2)
{
	draw_sprite(buffer, R->img_perdu,R->x, R->y);
}

}



void destroy_Rebecca(Rebecca *R)
{
	//int i;
		destroy_bitmap(R->img_bravo);
		destroy_bitmap(R->img_erreur);
                destroy_bitmap(R->img_perdu);

}
